package algo_lignes_sites.params;

import algo_lignes_sites.params.param_component.ParamComponent_table_ContrainteGeomLine;
import algo_lignes_sites.params.param_component.ParamComponent_table_ContrainteGeomNode;
import algo_lignes_sites.params.param_component.ParamComponent_table_EchelleParticuliere;
import commons.data.EchelleGeneralization;
import commons.data.Zone;
import commons.data.category.Category;
import commons.io.in.Data_in;
import commons.logs.Logger;
import commons.params.A_Params;
import commons.params.A_Params.TYPE_OBJECT;
import commons.params.A_ParamsManager;
import commons.params.param_component.ParamComponent_list_Select;
import commons.params.param_component.ParamComponent_simple;
import commons.params.param_component.ParamComponent_simple.Condition;
import commons.params.param_component.ParamComponent_simple.TypeParam;
import commons.params.param_component.ParamComponent_table_Categorie;
import commons.params.param_component.ParamComponent_table_Color;
import commons.params.param_component.ParamComponent_table_Zone;
import commons.params_appli.ParamsAppli;
import commons.utils.Utils;
import java.util.ArrayList;
import javax.swing.JFrame;

public class ParamsManager_ls extends A_ParamsManager {

	// pointe sur dlg, mais avec le bon type
	private DlgParams_ls dlg_ls;

	public final static String PARAM_DATAIN_COUCHE_LINE = "nom_couche_ligne";
	public final static String PARAM_DATAIN_COUCHE_NODE = "nom_couche_noeud";
	public final static String PARAM_DATAIN_LISTE_CHAMPSFUSION_LINE = "liste_champs_fusion_ligne";
	public final static String PARAM_DATAIN_TABLE_CATEGORIES_LINE = "table_categorie_ligne";
	public final static String PARAM_DATAIN_TABLE_CATEGORIES_NODE = "table_categorie_noeud";
	public final static String PARAM_DATAIN_MAINFILTER_LINE = "filtre_principal_ligne";
	public final static String PARAM_DATAIN_MAINFILTER_NODE = "filtre_principal_noeud";

	public final static String PARAM_ZONE_TABLE_ZONE = "table_zone";

	public final static String PARAM_PARAMGEN_ECHELLEPRINCIPALE = "echelle_principale";
	public final static String PARAM_PARAMGEN_TABLE_ECHELLEPARTICULIERE = "table_echelle_particuliere";
	public final static String PARAM_PARAMGEN_ECHELLEPARTICULIERE_CATEGORY_1 = "echelle_particuliere_categorie_1";
	public final static String PARAM_PARAMGEN_ECHELLEPARTICULIERE_VALUE_1 = "echelle_particuliere_valeur_1";
	public final static String PARAM_PARAMGEN_TABLE_CONTRAINTEGEOM_LINE = "table_contrainte_geom_ligne";
	
	public final static String PARAM_PARAMGEN_TABLE_CONTRAINTEGEOM_NODE = "table_contrainte_geom_noeud";
	public final static String PARAM_PARAMGEN_INFLUENCE_INTERSECTION = "influence_intersection";


	public final static String PARAM_PARAMAFFICH_TABLE_COLOR_LINE = "table_couleur_ligne";
	public final static String PARAM_PARAMAFFICH_CHAMPLIBELLE_LINE = "champ_libelle_ligne";
	public final static String PARAM_PARAMAFFICH_CHAMPTRI_LINE = "champ_tri_ligne";
	public final static String PARAM_PARAMAFFICH_TRIBIGGESTONTOP_LINE = "tri_biggestOnTop_ligne";
	public final static String PARAM_PARAMAFFICH_BARBULE_ACTIVATOR = "affichage_barbule_activator";
	public final static String PARAM_PARAMAFFICH_EPAISSEUR_BARBULE= "epaisseur_barbule";
	public final static String PARAM_PARAMAFFICH_INTER_BARBULE= "espace_entre_barbule";

	public final static String PARAM_PARAMAFFICH_TABLE_COLOR_NODE = "table_couleur_noeud";
	public final static String PARAM_PARAMAFFICH_CHAMPLIBELLE_NODE = "champ_libelle_node";
	public final static String PARAM_PARAMAFFICH_CHAMPTRI_NODE = "champ_tri_node";
	public final static String PARAM_PARAMAFFICH_TRIBIGGESTONTOP_NODE = "tri_biggestOnTop_node";

	public final static String PARAM_PARAMAVANCE_SNAP_NODE_ACTIVATOR = "snap_node_activator";
	public final static String PARAM_PARAMAVANCE_TOLERANCE_SNAP_NODE = "tolerance_snap_node";

	public final static String PARAM_PARAMAVANCE_SIMPLIF_TRACE_LINE_ACTIVATOR = "simplification_path_activator";
	public final static String PARAM_PARAMAVANCE_TOLERENCE_SIMPLIF_TRACE_LINE = "tolerence_simplification_path";

	public final static String PARAM_PARAMAVANCE_REDECOUP_LINE_ACTIVATOR = "redecoupage_path_activator";
	public final static String PARAM_PARAMAVANCE_LGMAXSEGMENT = "longueur_maxi_redecoupage_path";
	public final static String PARAM_PARAMAVANCE_LGMAXSEGMENT_PROCHENODE = "longueur_maxi_redecoupage_path_proche_node";
	public final static String PARAM_PARAMAVANCE_RAYONACTION_REDECOUPSEG_PROCHENODE = "rayon_action_redecoupage_path_proche_node";
	public final static String PARAM_PARAMAVANCE_NBMIN_POINT_ENTRE2NODE = "nb_min_point_entre_2_node";

	public final static String PARAM_PARAMAVANCE_OPTIM_DISSYMETRIE_ACTIVATOR = "optim_dissymetrie_activator";


	public final static String PARAM_PARAMAVANCE_SIMPLIF_TOPO_ACTIVATOR = "simplification_topo_activator";
	public final static String PARAM_PARAMAVANCE_ETENDUE_SIMPLIF_TOPO = "etendue_simplification_topo";

	public final static String PARAM_PARAMAVANCE_SIMPLIF_NODE_ACTIVATOR = "simplification_node_activator";
//	public final static String PARAM_PARAMAVANCE_ETENDUESIMPLIF_NODE = "etendue_simplification_node";
	// désormais, ce paramètre est défini pour chaque catégorie de node
	
	public final static String PARAM_PARAMAVANCE_FUSIONNODEDOUBLON_ACTIVATOR = "fusion_node_doublon_activator";
	public final static String PARAM_PARAMAVANCE_FUSIONNODEDOUBLON_PARAMCOMMUN = "fusion_node_doublon_parametre_commun";
	public final static String PARAM_PARAMAVANCE_FUSIONNODEDOUBLON_DISTMAX = "fusion_node_doublon_distance_max";
	public final static String PARAM_PARAMAVANCE_FUSIONNODEDOUBLON_CATEXLUDED = "fusion_node_doublon_categorie_exclue";
	public final static String PARAM_PARAMAVANCE_FUSIONNODEDOUBLON_DEFUSIONNE = "fusion_node_doublon_defusionne";
	
	public final static String PARAM_PARAMAVANCE_REDUCTIONINFLUENCE_NODESIMPLE_ACTIVATOR = "reduction_influence_node_simple_activator";
	public final static String PARAM_PARAMAVANCE_REDUCTIONINFLUENCE_NODESIMPLE_SEUIL = "reduction_influence_node_simple_seuil";
	
	public final static String PARAM_PARAMAVANCE_LIMITATION_MVT_ZONE_DENSE_ACTIVATOR = "limitation_mvt_zones_denses_activator";
	public final static String PARAM_PARAMAVANCE_LIMITATION_MVT_ZONE_DENSE_SEUIL = "limitation_mvt_zones_denses_seuil";

	public final static String PARAM_PARAMAVANCE_ALGO_SIMPLIF_TROU_NOIR_ACTIVATOR = "algo_optim_trou_noir_activator";
	public final static String PARAM_PARAMAVANCE_ALGO_SIMPLIF_TROU_NOIR_SEUIL = "algo_optim_trou_noir_seuil";
	public final static String PARAM_PARAMAVANCE_ALGO_SIMPLIF_TROU_NOIR_CATEGORY = "algo_optim_trou_noir_categorie";

	public final static String PARAM_PARAMAVANCE_FORCE_REPULSFROMNODE = "poids_force_repuls_from_node";
	public final static String PARAM_PARAMAVANCE_FORCE_REPULSFROMLINE = "poids_force_repuls_from_path";
	public final static String PARAM_PARAMAVANCE_FORCE_ATTRACTPOSNODE = "poids_force_attract_pos_node";
	public final static String PARAM_PARAMAVANCE_FORCE_ATTRACTPOSLINE = "poids_force_attract_pos_path";
	public final static String PARAM_PARAMAVANCE_FORCE_ENTRAINBYNODE = "poids_force_entrainement_by_node";
	public final static String PARAM_PARAMAVANCE_FORCE_RESPECTFORME = "poids_force_respect_forme";

	public final static String PARAM_PARAMAVANCE_ALGO_ECHELLEINIT = "algo_echelle_init";
	public final static String PARAM_PARAMAVANCE_ALGO_ACCROISSECHELLE = "algo_accroissement_echelle";
	public final static String PARAM_PARAMAVANCE_ALGO_NBITERPARECHELLE = "algo_nb_iter_par_echelle";
	public final static String PARAM_PARAMAVANCE_ALGO_NBITERFINAL = "algo_nb_iter_final";
	public final static String PARAM_PARAMAVANCE_ALGO_POIDFORCE_RESPECT_FORME_FINAL = "poids_force_respect_forme_final";

	public final static String PARAM_PARAMAVANCE_ALGO_PAS_TEMP = "algo_pas_temps";
	public final static String PARAM_PARAMAVANCE_ALGO_FACTEUR_FROTTEMENT = "algo_facteur_frottement";


	
	// En argument, le Data_in contenant les couches d'entrées
	public ParamsManager_ls(JFrame frameParent, Data_in dataIn) {
		super(frameParent, dataIn);
	}

	@Override
	public String getDirectoryUserParams() {return ParamsAppli.getParam("Autogene.REPERTOIRE_PARAM_TRAITEMENT_LS");}

	@Override
	protected void createDlg(JFrame frameParent) {
		dlg = new DlgParams_ls(frameParent, true);
		dlg_ls = (DlgParams_ls) dlg;
	}

	@Override
	protected void initParamComponent() {
		ParamComponent_simple a;

		registerParamComponent (new ParamComponent_simple(PARAM_DATAIN_COUCHE_LINE, this, dlg_ls.combo_CoucheLine, TypeParam.TYPE_STRING, false, false));
		registerParamComponent (new ParamComponent_simple(PARAM_DATAIN_COUCHE_NODE, this, dlg_ls.combo_CoucheNode, TypeParam.TYPE_STRING, false, false));
		registerParamComponent (new ParamComponent_list_Select(PARAM_DATAIN_LISTE_CHAMPSFUSION_LINE, this, dlg_ls.list_ChampsFusionLigne, false));
		registerParamComponent (new ParamComponent_table_Categorie(PARAM_DATAIN_TABLE_CATEGORIES_LINE, this, dlg_ls.table_CategoryLine, true));
		registerParamComponent (new ParamComponent_table_Categorie(PARAM_DATAIN_TABLE_CATEGORIES_NODE, this, dlg_ls.table_CategoryNode, true));
		registerParamComponent (new ParamComponent_simple(PARAM_DATAIN_MAINFILTER_LINE, this, dlg_ls.combo_MainFilterLine, TypeParam.TYPE_STRING, false));
		registerParamComponent (new ParamComponent_simple(PARAM_DATAIN_MAINFILTER_NODE, this, dlg_ls.combo_MainFilterNode, TypeParam.TYPE_STRING, false));

		registerParamComponent (new ParamComponent_table_Zone(PARAM_ZONE_TABLE_ZONE, this, dlg_ls.table_Zone, true));

		registerParamComponent (new ParamComponent_simple(PARAM_PARAMGEN_ECHELLEPRINCIPALE, this, dlg_ls.tf_EchellePrincipale, TypeParam.TYPE_FLOAT, false, Condition.POSITIVE));
		registerParamComponent (new ParamComponent_table_EchelleParticuliere(PARAM_PARAMGEN_TABLE_ECHELLEPARTICULIERE, this, dlg_ls.table_EchelleZoneParticuliere, true));
		registerParamComponent (new ParamComponent_table_ContrainteGeomLine(PARAM_PARAMGEN_TABLE_CONTRAINTEGEOM_LINE, this, dlg_ls.table_ContrainteGeomLine, false));
		registerParamComponent (new ParamComponent_table_ContrainteGeomNode(PARAM_PARAMGEN_TABLE_CONTRAINTEGEOM_NODE, this, dlg_ls.table_ContrainteGeomNode, false));
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMGEN_INFLUENCE_INTERSECTION, this, dlg_ls.tf_InfluenceIntersection, TypeParam.TYPE_FLOAT, false, Condition.POSITIVE_STRICT));

		registerParamComponent (new ParamComponent_table_Color(PARAM_PARAMAFFICH_TABLE_COLOR_LINE, this, dlg_ls.table_RepresentationLine, true));
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAFFICH_CHAMPLIBELLE_LINE, this, dlg_ls.combo_ChampLibelleLine, TypeParam.TYPE_STRING, false));
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAFFICH_CHAMPTRI_LINE, this, dlg_ls.combo_ChampTriLine, TypeParam.TYPE_STRING, false));
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAFFICH_TRIBIGGESTONTOP_LINE, this, dlg_ls.cb_BiggestOnTopLine, TypeParam.TYPE_BOOL, false));
		
		a = new ParamComponent_simple(PARAM_PARAMAFFICH_BARBULE_ACTIVATOR, this, dlg_ls.cb_ShowBarbules, TypeParam.TYPE_BOOL, false);
		registerParamComponent (a);
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAFFICH_EPAISSEUR_BARBULE, this, dlg_ls.tf_EpaisseurBarbule, TypeParam.TYPE_FLOAT, false, Condition.POSITIVE_STRICT, a));
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAFFICH_INTER_BARBULE, this, dlg_ls.tf_InterBarbule, TypeParam.TYPE_FLOAT, false, Condition.POSITIVE_STRICT, a));

		registerParamComponent (new ParamComponent_table_Color(PARAM_PARAMAFFICH_TABLE_COLOR_NODE, this, dlg_ls.table_RepresentationNode, true));
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAFFICH_CHAMPLIBELLE_NODE, this, dlg_ls.combo_ChampLibelleNode, TypeParam.TYPE_STRING, false));
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAFFICH_CHAMPTRI_NODE, this, dlg_ls.combo_ChampTriNode, TypeParam.TYPE_STRING, false));
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAFFICH_TRIBIGGESTONTOP_NODE, this, dlg_ls.cb_BiggestOnTopNode, TypeParam.TYPE_BOOL, false));

		
		a = new ParamComponent_simple(PARAM_PARAMAVANCE_SNAP_NODE_ACTIVATOR, this, dlg_ls.cb_ActivateSnapNode, TypeParam.TYPE_BOOL, false);
		registerParamComponent (a);
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAVANCE_TOLERANCE_SNAP_NODE, this, dlg_ls.tf_ToleranceSnap, TypeParam.TYPE_FLOAT, false, Condition.POSITIVE, a));

		a = new ParamComponent_simple(PARAM_PARAMAVANCE_SIMPLIF_NODE_ACTIVATOR, this, dlg_ls.cb_ActivateSimplifNode, TypeParam.TYPE_BOOL, false);
		registerParamComponent (a);
		//registerParamComponent (new ParamComponent_simple(PARAM_PARAMAVANCE_ETENDUESIMPLIF_NODE, this, dlg_ls.tf_EtendueSimplifNode, TypeParam.TYPE_FLOAT, false, Condition.POSITIVE, a));
		// désormais, ce paramètre est défini pour chaque catégorie de node

		a = new ParamComponent_simple(PARAM_PARAMAVANCE_FUSIONNODEDOUBLON_ACTIVATOR, this, dlg_ls.cb_ActivateFusionNodeDoublon, TypeParam.TYPE_BOOL, false);
		registerParamComponent (a);
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAVANCE_FUSIONNODEDOUBLON_PARAMCOMMUN, this, dlg_ls.combo_ChampDetectionNodeDoublon, TypeParam.TYPE_STRING, false, a));
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAVANCE_FUSIONNODEDOUBLON_DISTMAX, this, dlg_ls.tf_DistMaxNodeDoublon, TypeParam.TYPE_FLOAT, false, Condition.POSITIVE, a));
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAVANCE_FUSIONNODEDOUBLON_CATEXLUDED, this, dlg_ls.combo_categorieExcluFusionNodeDoublon, TypeParam.TYPE_STRING, true, a));
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAVANCE_FUSIONNODEDOUBLON_DEFUSIONNE, this, dlg_ls.cb_DefusionneFinTraitement, TypeParam.TYPE_BOOL, false, a));
		
		a = new ParamComponent_simple(PARAM_PARAMAVANCE_SIMPLIF_TRACE_LINE_ACTIVATOR, this, dlg_ls.cb_ActivateSimplifTraceLine, TypeParam.TYPE_BOOL, false);
		registerParamComponent (a);
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAVANCE_TOLERENCE_SIMPLIF_TRACE_LINE, this, dlg_ls.tf_TolerenceSimplifPath, TypeParam.TYPE_FLOAT, false, Condition.POSITIVE, a));

		a = new ParamComponent_simple(PARAM_PARAMAVANCE_REDECOUP_LINE_ACTIVATOR, this, dlg_ls.cb_ActivateRedecoupLine, TypeParam.TYPE_BOOL, false);
		registerParamComponent (a);
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAVANCE_LGMAXSEGMENT, this, dlg_ls.tf_LgMaxSegRedecoupagePath_std, TypeParam.TYPE_FLOAT, false, Condition.POSITIVE, a));
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAVANCE_LGMAXSEGMENT_PROCHENODE, this, dlg_ls.tf_LgMaxSegRedecoupagePath_procheNode, TypeParam.TYPE_FLOAT, false, Condition.POSITIVE, a));
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAVANCE_RAYONACTION_REDECOUPSEG_PROCHENODE, this, dlg_ls.tf_RayonActionRedecoupagePath_procheNode, TypeParam.TYPE_FLOAT, false, Condition.POSITIVE, a));
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAVANCE_NBMIN_POINT_ENTRE2NODE, this, dlg_ls.tf_NbMinPointEntreNode, TypeParam.TYPE_INT, false, Condition.POSITIVE, a));
		
		a = new ParamComponent_simple(PARAM_PARAMAVANCE_OPTIM_DISSYMETRIE_ACTIVATOR, this, dlg_ls.cb_ActivateOptimDissymetrie, TypeParam.TYPE_BOOL, false);
		registerParamComponent (a);


		a = new ParamComponent_simple(PARAM_PARAMAVANCE_SIMPLIF_TOPO_ACTIVATOR, this, dlg_ls.cb_ActivateSimplifTopo, TypeParam.TYPE_BOOL, false);
		registerParamComponent (a);
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAVANCE_ETENDUE_SIMPLIF_TOPO, this, dlg_ls.tf_EtendueSimplifTopo, TypeParam.TYPE_FLOAT, false, Condition.POSITIVE, a));

		
		a = new ParamComponent_simple(PARAM_PARAMAVANCE_LIMITATION_MVT_ZONE_DENSE_ACTIVATOR, this, dlg_ls.cb_LimitationMvtZoneDense, TypeParam.TYPE_BOOL, false);
		registerParamComponent (a);
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAVANCE_LIMITATION_MVT_ZONE_DENSE_SEUIL, this, dlg_ls.tf_SeuilLimitationMvtZoneDense, TypeParam.TYPE_INT, false, Condition.POSITIVE, a));
		
		a = new ParamComponent_simple(PARAM_PARAMAVANCE_REDUCTIONINFLUENCE_NODESIMPLE_ACTIVATOR, this, dlg_ls.cb_ReducInfluenceNodeSimple, TypeParam.TYPE_BOOL, false);
		registerParamComponent (a);
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAVANCE_REDUCTIONINFLUENCE_NODESIMPLE_SEUIL, this, dlg_ls.tf_SeuilReductionInfluenceNodeSimple, TypeParam.TYPE_FLOAT, false, Condition.POSITIVE, a));

		a = new ParamComponent_simple(PARAM_PARAMAVANCE_ALGO_SIMPLIF_TROU_NOIR_ACTIVATOR, this, dlg_ls.cb_SimplificationTrouNoir, TypeParam.TYPE_BOOL, false);
		registerParamComponent (a);
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAVANCE_ALGO_SIMPLIF_TROU_NOIR_SEUIL, this, dlg_ls.tf_SeuilComplexiteNodeTrouNoir, TypeParam.TYPE_INT, false, Condition.POSITIVE, a));
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAVANCE_ALGO_SIMPLIF_TROU_NOIR_CATEGORY, this, dlg_ls.combo_categoriePourTrouNoir, TypeParam.TYPE_STRING, true, a));

		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAVANCE_FORCE_REPULSFROMNODE, this, dlg_ls.tf_PoidForce_RepulsFromNode, TypeParam.TYPE_FLOAT, false, Condition.BETWEEN_INCLUSIVE, 0, 5));
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAVANCE_FORCE_REPULSFROMLINE, this, dlg_ls.tf_PoidForce_RepulsFromPath, TypeParam.TYPE_FLOAT, false, Condition.BETWEEN_INCLUSIVE, 0, 5));
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAVANCE_FORCE_ATTRACTPOSNODE, this, dlg_ls.tf_PoidForce_AttractPosInitNode, TypeParam.TYPE_FLOAT, false, Condition.BETWEEN_INCLUSIVE, 0, 5));
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAVANCE_FORCE_ATTRACTPOSLINE, this, dlg_ls.tf_PoidForce_AttractPosInitPath, TypeParam.TYPE_FLOAT, false, Condition.BETWEEN_INCLUSIVE, 0, 5));
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAVANCE_FORCE_ENTRAINBYNODE, this, dlg_ls.tf_PoidForce_EntrainementByNode, TypeParam.TYPE_FLOAT, false, Condition.BETWEEN_INCLUSIVE, 0, 5));
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAVANCE_FORCE_RESPECTFORME, this, dlg_ls.tf_PoidForce_RespectForme, TypeParam.TYPE_FLOAT, false, Condition.BETWEEN_INCLUSIVE, 0, 5));

		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAVANCE_ALGO_ECHELLEINIT, this, dlg_ls.tf_Algo_EchelleInit, TypeParam.TYPE_FLOAT, false, Condition.BETWEEN_INCLUSIVE, 200, 999999999));
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAVANCE_ALGO_ACCROISSECHELLE, this, dlg_ls.tf_Algo_FacteurAccroissEchelle, TypeParam.TYPE_FLOAT, false, Condition.BETWEEN_INCLUSIVE, 1.001, 100));
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAVANCE_ALGO_NBITERPARECHELLE, this, dlg_ls.tf_Algo_NbIterParEchelle, TypeParam.TYPE_INT, false, Condition.POSITIVE_STRICT));

		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAVANCE_ALGO_NBITERFINAL, this, dlg_ls.tf_Algo_NbIterFinal, TypeParam.TYPE_INT, false, Condition.POSITIVE_STRICT));
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAVANCE_ALGO_POIDFORCE_RESPECT_FORME_FINAL, this, dlg_ls.tf_PoidForce_RespectFormeFinal, TypeParam.TYPE_FLOAT, false, Condition.BETWEEN_INCLUSIVE, 0, 5));


		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAVANCE_ALGO_PAS_TEMP, this, dlg_ls.tf_Algo_PasDeTemps, TypeParam.TYPE_FLOAT, false, Condition.POSITIVE_STRICT));
		registerParamComponent (new ParamComponent_simple(PARAM_PARAMAVANCE_ALGO_FACTEUR_FROTTEMENT, this, dlg_ls.tf_Algo_FacteurFrottement, TypeParam.TYPE_FLOAT, false, Condition.POSITIVE));
	}

	//**********************************************************************
	// APRES RECUP DE TOUTES LES VALEURS DE LA DLG
	// AVANT LES CONTROLES et REECRITURE DANS LA DLG
	// Re-création des valeurs possibles pour les comboBox, list et autres tables
	// En effet, elles peuvent dépendre des différents autres paramètres saisis par l'utilisateur
	// Ces reinit de valeurs possibles sont à réaliser AVANT appel à
	//  checkValid() et writeToComponent() et donc avant controlAllParams()
	//**********************************************************************
	@Override
	protected void setValeursPossible() {
		ArrayList<String>[] possibleValues;

		String nomCoucheLigne = (String)getParamComponent(PARAM_DATAIN_COUCHE_LINE).getValue();
		String nomCoucheNode = (String)getParamComponent(PARAM_DATAIN_COUCHE_NODE).getValue();

		ArrayList<String> vCatLine = ((ParamComponent_table_Categorie)getParamComponent(PARAM_DATAIN_TABLE_CATEGORIES_LINE)).getListNomCategories_plusCategorieAllData();
		ArrayList<String> vCatLine_plusVide = new ArrayList<String>();
		vCatLine_plusVide.add("");
		vCatLine_plusVide.addAll(vCatLine);

		ArrayList<String> vCatNode = ((ParamComponent_table_Categorie)getParamComponent(PARAM_DATAIN_TABLE_CATEGORIES_NODE)).getListNomCategories_plusCategorieAllData();
		ArrayList<String> vCatNode_plusVide = new ArrayList<String>();
		vCatNode_plusVide.add("");
		vCatNode_plusVide.addAll(vCatNode);
		
		ArrayList<String> vNomZone = ((ParamComponent_table_Zone)getParamComponent(PARAM_ZONE_TABLE_ZONE)).getListNomZones();
		ArrayList<String> vNomZone_plusZonePrincipale = ((ParamComponent_table_Zone)getParamComponent(PARAM_ZONE_TABLE_ZONE)).getListNomZones_plusZonePrincipale();

		ArrayList<String> vAllChampNode =  dataIn.getChampsOfCouche(nomCoucheNode);
		ArrayList<String> vAllChampLine =  dataIn.getChampsOfCouche(nomCoucheLigne);
		ArrayList<String> vChampFusionLine = (ArrayList) getParamComponent(PARAM_DATAIN_LISTE_CHAMPSFUSION_LINE).getValue();

		//**********************************************************************
		//******** ONGLET Données d'entrée *************************************

		// combo couche ligne a généraliser
		getParamComponent(PARAM_DATAIN_COUCHE_LINE).setPossibleValues(dataIn.getAllCoucheNames_typeLIN());

		// combo couche node a généraliser
		getParamComponent(PARAM_DATAIN_COUCHE_NODE).setPossibleValues(dataIn.getAllCoucheNames_typePT());

		// liste des champs de la couche de ligne (pour choix des champs de fusion
		getParamComponent(PARAM_DATAIN_LISTE_CHAMPSFUSION_LINE).setPossibleValues(dataIn.getChampsOfCouche(nomCoucheLigne));

		// table des catégories de lignes et nodes
		// On fournit
		//   - pour la 2eme colonne : la liste des noms de catégorie déj saisis en 1ere colonne
		//   - pour la 3ème colonne : la liste des champs possibles (issus de la couche des lignes)
		possibleValues = new ArrayList[] {null, vCatLine, vAllChampLine, null};
		getParamComponent(PARAM_DATAIN_TABLE_CATEGORIES_LINE).setPossibleValues(possibleValues);
		possibleValues = new ArrayList[] {null, vCatNode, vAllChampNode, null};
		getParamComponent(PARAM_DATAIN_TABLE_CATEGORIES_NODE).setPossibleValues(possibleValues);

		// Filtres principaux pour les lignes et les nodes
		// on peut choisir parmi l'une des catégories créée par l'utilisateur
		getParamComponent(PARAM_DATAIN_MAINFILTER_LINE).setPossibleValues(vCatLine);
		getParamComponent(PARAM_DATAIN_MAINFILTER_NODE).setPossibleValues(vCatNode);


		//**********************************************************************
		//******** ONGLET Zone *************************************************

		// La table des zones n'a pas de valeurs possible dépendant des autres component
		// Les différentes valeurs possibles sont statiques et initialisée par le
		//  constructeur de ParamComponent_table_Zone


		//**********************************************************************
		//******** ONGLET Paramètres de généralisation *************************

		// Table des echelles pour les zones particulières
		possibleValues = new ArrayList[] {vNomZone_plusZonePrincipale, vCatLine_plusVide, vCatNode_plusVide, null};
		getParamComponent(PARAM_PARAMGEN_TABLE_ECHELLEPARTICULIERE).setPossibleValues(possibleValues);

		// Tables des contraintes géométriques des lignes et noeuds
		possibleValues = new ArrayList[] {vCatLine, null, null, null, Utils.getVValeurPossibleSidePlusVide()};
		getParamComponent(PARAM_PARAMGEN_TABLE_CONTRAINTEGEOM_LINE).setPossibleValues(possibleValues);
		possibleValues = new ArrayList[] {vCatNode, null, null, null, null, null, null, null};
		getParamComponent(PARAM_PARAMGEN_TABLE_CONTRAINTEGEOM_NODE).setPossibleValues(possibleValues);

		//**********************************************************************
		//******** ONGLET Paramètres d'affichage *******************************

		// Tables des couleurs de lignes et noeuds
		possibleValues = new ArrayList[] {vCatLine, null};
		getParamComponent(PARAM_PARAMAFFICH_TABLE_COLOR_LINE).setPossibleValues(possibleValues);
		possibleValues = new ArrayList[] {vCatNode, null};
		getParamComponent(PARAM_PARAMAFFICH_TABLE_COLOR_NODE).setPossibleValues(possibleValues);

		getParamComponent(PARAM_PARAMAFFICH_CHAMPLIBELLE_LINE).setPossibleValues(vChampFusionLine);
		getParamComponent(PARAM_PARAMAFFICH_CHAMPTRI_LINE).setPossibleValues(vChampFusionLine);
		getParamComponent(PARAM_PARAMAFFICH_CHAMPLIBELLE_NODE).setPossibleValues(vAllChampNode);
		getParamComponent(PARAM_PARAMAFFICH_CHAMPTRI_NODE).setPossibleValues(vAllChampNode);

		//**********************************************************************
		//******** ONGLET Paramètres avancés ***********************************
		
		// fusion node en doublon
		getParamComponent(PARAM_PARAMAVANCE_FUSIONNODEDOUBLON_PARAMCOMMUN).setPossibleValues(vAllChampNode);
		getParamComponent(PARAM_PARAMAVANCE_FUSIONNODEDOUBLON_CATEXLUDED).setPossibleValues(vCatNode);
		
		// mode trou noir
		getParamComponent(PARAM_PARAMAVANCE_ALGO_SIMPLIF_TROU_NOIR_CATEGORY).setPossibleValues(vCatNode);
	}


	// controle specifiques pour certains components
	@Override
	protected void controlesSpeciaux() {

		//**********************************************************************
		// Le rayon de simplification de node ne peut etre plus petit que le plus petit rayon d'influence nulle
//		ParamComponent_simple cs = getParamComponent_s(PARAM_PARAMAVANCE_ETENDUESIMPLIF_NODE);
//		if (!cs.needControl())
//			return; // option desactivée -> rien a tester
//		if (!cs.isValide())
//			return; // on ne peut poursuivre ce test
//
//		double factRayonSimplifNode = cs.getValue_double();
//
//		// A present, on doit récupérer le plus petit rayon d'influence nulle
//		ParamComponent_table_ContrainteGeomNode table_cgn = (ParamComponent_table_ContrainteGeomNode) getParamComponent(PARAM_PARAMGEN_TABLE_CONTRAINTEGEOM_NODE);
//		if (!table_cgn.isValide())
//			return; // on ne peut poursuivre ce test
//
//		double minFacteurRayonInfluenceNulle = table_cgn.getMinInfluenceNulle();
//
//		if (factRayonSimplifNode>minFacteurRayonInfluenceNulle)
//			cs.invalidateComponent("Le rayon de simplification de node doit être plus petit que les rayons d'influence nulle", true);

	}

	// En sortie de la dlg, on crée un objet Params qui reprend l'ensemble des paramètres
	//  en type de base + classes spécifiques
	@Override
	protected A_Params createParams() {
		Params_ls params = new Params_ls();

		params.nomParam = getName();
		
		params.nomCoucheLine = (String) getParamComponent(PARAM_DATAIN_COUCHE_LINE).getValue();
		params.nomCoucheNode = (String) getParamComponent(PARAM_DATAIN_COUCHE_NODE).getValue();
		params.coucheLine = dataIn.getCouche(params.nomCoucheLine);
		params.coucheNode = dataIn.getCouche(params.nomCoucheNode);

		params.vChampFusionLine = (ArrayList) getParamComponent(PARAM_DATAIN_LISTE_CHAMPSFUSION_LINE).getValue();

		params.vCategoryLine = ((ParamComponent_table_Categorie)getParamComponent(PARAM_DATAIN_TABLE_CATEGORIES_LINE)).getVCategory();
		params.vCategoryNode = ((ParamComponent_table_Categorie)getParamComponent(PARAM_DATAIN_TABLE_CATEGORIES_NODE)).getVCategory();

		params.mainFilterLine = params.getCategoryPathByName((String) getParamComponent(PARAM_DATAIN_MAINFILTER_LINE).getValue());
		params.mainFilterNode = params.getCategoryNodeByName((String) getParamComponent(PARAM_DATAIN_MAINFILTER_NODE).getValue());

		params.vZone = ((ParamComponent_table_Zone)getParamComponent(PARAM_ZONE_TABLE_ZONE)).getVZone();

		params.vEchelleGeneralization_path = new ArrayList<EchelleGeneralization>();
		params.vEchelleGeneralization_node = new ArrayList<EchelleGeneralization>();
		// Règle de généralisation principale (= par défaut, celle qui s'applique aux éléments qui n'ont pas de règle spécifique)
		// Elle se trouve en 1ere position dans le vecteur de règle
		double echellePrincipale_inv = getParamComponent_s(PARAM_PARAMGEN_ECHELLEPRINCIPALE).getValue_double();
		params.vEchelleGeneralization_path.add (new EchelleGeneralization(Zone.zonePrincipale, Category.categoryAllData, echellePrincipale_inv));
		params.vEchelleGeneralization_node.add (new EchelleGeneralization(Zone.zonePrincipale, Category.categoryAllData, echellePrincipale_inv));
		// Règles spécifiques, basées sur des zones particulières
		params.vEchelleGeneralization_path.addAll(((ParamComponent_table_EchelleParticuliere)getParamComponent(PARAM_PARAMGEN_TABLE_ECHELLEPARTICULIERE)).getVEchelleParamParticuliere_path(params));
		params.vEchelleGeneralization_node.addAll(((ParamComponent_table_EchelleParticuliere)getParamComponent(PARAM_PARAMGEN_TABLE_ECHELLEPARTICULIERE)).getVEchelleParamParticuliere_node(params));

		// l'échelle cible inv de la carte est le max des différentes échelles des objets (l'échelle principale peut etre = 0 et >0 dans certaines zones)
		double echelleCible_inv = echellePrincipale_inv;
		for (EchelleGeneralization eg : params.vEchelleGeneralization_node) echelleCible_inv = Math.max(echelleCible_inv, eg.echelle_inv);
		for (EchelleGeneralization eg : params.vEchelleGeneralization_path) echelleCible_inv = Math.max(echelleCible_inv, eg.echelle_inv);
		params.echelleCible = 1/echelleCible_inv;

		params.vContrainteGeomLine = ((ParamComponent_table_ContrainteGeomLine)getParamComponent(PARAM_PARAMGEN_TABLE_CONTRAINTEGEOM_LINE)).getVContrainteGeomLine(params);
		
		//contrainte geometrique des nodes
		params.vContrainteGeomNode = ((ParamComponent_table_ContrainteGeomNode)getParamComponent(PARAM_PARAMGEN_TABLE_CONTRAINTEGEOM_NODE)).getVContrainteGeomNode(params);

		params.influenceIntersection = getParamComponent_s(PARAM_PARAMGEN_INFLUENCE_INTERSECTION).getValue_double();


		// Params d'affichage
		params.vColorLine = ((ParamComponent_table_Color)getParamComponent(PARAM_PARAMAFFICH_TABLE_COLOR_LINE)).getVColor(params, TYPE_OBJECT.PATH_LS);
		params.vColorNode = ((ParamComponent_table_Color)getParamComponent(PARAM_PARAMAFFICH_TABLE_COLOR_NODE)).getVColor(params, TYPE_OBJECT.NODE_LS);

		params.champLibelleLine = getParamComponent_s(PARAM_PARAMAFFICH_CHAMPLIBELLE_LINE).getValue_string();
		params.champLibelleNode = getParamComponent_s(PARAM_PARAMAFFICH_CHAMPLIBELLE_NODE).getValue_string();
		params.champTriLine = getParamComponent_s(PARAM_PARAMAFFICH_CHAMPTRI_LINE).getValue_string();
		params.champTriNode = getParamComponent_s(PARAM_PARAMAFFICH_CHAMPTRI_NODE).getValue_string();
		params.bBiggestOnTopLine = getParamComponent_s(PARAM_PARAMAFFICH_TRIBIGGESTONTOP_LINE).getValue_bool();
		params.bBiggestOnTopNode = getParamComponent_s(PARAM_PARAMAFFICH_TRIBIGGESTONTOP_NODE).getValue_bool();

		params.bShowBarbules = getParamComponent_s(PARAM_PARAMAFFICH_BARBULE_ACTIVATOR).getValue_bool();
		if (params.bShowBarbules) {
			params.factor_EpaisseurBarbules = getParamComponent_s(PARAM_PARAMAFFICH_EPAISSEUR_BARBULE).getValue_double();
			params.factor_InterBarbules = getParamComponent_s(PARAM_PARAMAFFICH_INTER_BARBULE).getValue_double();
		} else {
			params.factor_EpaisseurBarbules = 0;
			params.factor_InterBarbules = 0;
		}

		// Paramètres avancés
		if (getParamComponent_s(PARAM_PARAMAVANCE_SNAP_NODE_ACTIVATOR).getValue_bool())
			params.toleranceSnapNode = getParamComponent_s(PARAM_PARAMAVANCE_TOLERANCE_SNAP_NODE).getValue_double();
		else
			params.toleranceSnapNode = 0;

		// simplif node
		params.bSimplifNode = getParamComponent_s(PARAM_PARAMAVANCE_SIMPLIF_NODE_ACTIVATOR).getValue_bool();
		
		// fusion node
		params.bFusionNodeDoublon = getParamComponent_s(PARAM_PARAMAVANCE_FUSIONNODEDOUBLON_ACTIVATOR).getValue_bool();
		params.fusionNode_commonField = getParamComponent_s(PARAM_PARAMAVANCE_FUSIONNODEDOUBLON_PARAMCOMMUN).getValue_string();
		params.fusionNode_distMax = getParamComponent_s(PARAM_PARAMAVANCE_FUSIONNODEDOUBLON_DISTMAX).getValue_double();
		params.fusionNode_catExcluded = params.getCategoryNodeByName(getParamComponent_s(PARAM_PARAMAVANCE_FUSIONNODEDOUBLON_CATEXLUDED).getValue_string());
		params.fusionNode_defusionFinTrt = getParamComponent_s(PARAM_PARAMAVANCE_FUSIONNODEDOUBLON_DEFUSIONNE).getValue_bool();

		if (getParamComponent_s(PARAM_PARAMAVANCE_SIMPLIF_TRACE_LINE_ACTIVATOR).getValue_bool())
			params.factor_SimplifPath_tolerance = getParamComponent_s(PARAM_PARAMAVANCE_TOLERENCE_SIMPLIF_TRACE_LINE).getValue_double();
		else
			params.factor_SimplifPath_tolerance = 0;

		if (getParamComponent_s(PARAM_PARAMAVANCE_REDECOUP_LINE_ACTIVATOR).getValue_bool()) {
			params.factor_RedecoupPath_lgSegMax_std = getParamComponent_s(PARAM_PARAMAVANCE_LGMAXSEGMENT).getValue_double();
			params.factor_RedecoupPath_lgSegMax_procheNode = getParamComponent_s(PARAM_PARAMAVANCE_LGMAXSEGMENT_PROCHENODE).getValue_double();
			params.factor_RayonAction_decoupSeg_procheNode = getParamComponent_s(PARAM_PARAMAVANCE_RAYONACTION_REDECOUPSEG_PROCHENODE).getValue_double();
			
			params.nbMinPointEntre2Node = getParamComponent_s(PARAM_PARAMAVANCE_NBMIN_POINT_ENTRE2NODE).getValue_int();
		} else {
			params.factor_RedecoupPath_lgSegMax_std = 0;
			params.factor_RedecoupPath_lgSegMax_procheNode = 0;
			params.factor_RayonAction_decoupSeg_procheNode = 0;
			params.nbMinPointEntre2Node = 0;
		}

		params.bOptimizeDissymetrie = getParamComponent_s(PARAM_PARAMAVANCE_OPTIM_DISSYMETRIE_ACTIVATOR).getValue_bool();

		if (getParamComponent_s(PARAM_PARAMAVANCE_SIMPLIF_TOPO_ACTIVATOR).getValue_bool())
			params.factor_SimplifTopo = getParamComponent_s(PARAM_PARAMAVANCE_ETENDUE_SIMPLIF_TOPO).getValue_double();
		else
			params.factor_SimplifTopo = 0;


		if (getParamComponent_s(PARAM_PARAMAVANCE_LIMITATION_MVT_ZONE_DENSE_ACTIVATOR).getValue_bool())
			params.seuilAttenuationMouvement = getParamComponent_s(PARAM_PARAMAVANCE_LIMITATION_MVT_ZONE_DENSE_SEUIL).getValue_double();
		else
			params.seuilAttenuationMouvement = 0;

		if (getParamComponent_s(PARAM_PARAMAVANCE_REDUCTIONINFLUENCE_NODESIMPLE_ACTIVATOR).getValue_bool())
			params.seuilPourReductionInfluenceNodeSimple = getParamComponent_s(PARAM_PARAMAVANCE_REDUCTIONINFLUENCE_NODESIMPLE_SEUIL).getValue_double();
		else
			params.seuilPourReductionInfluenceNodeSimple = 0;

		params.bSimplifTrouNoir = getParamComponent_s(PARAM_PARAMAVANCE_ALGO_SIMPLIF_TROU_NOIR_ACTIVATOR).getValue_bool();
		if (params.bSimplifTrouNoir)
			params.seuilComplexiteSimplifTrouNoir = getParamComponent_s(PARAM_PARAMAVANCE_ALGO_SIMPLIF_TROU_NOIR_SEUIL).getValue_int();
		else
			params.seuilComplexiteSimplifTrouNoir = -1;
		params.categorySimplifTrouNoir = params.getCategoryNodeByName(getParamComponent_s(PARAM_PARAMAVANCE_ALGO_SIMPLIF_TROU_NOIR_CATEGORY).getValue_string());


		params.poidsForce_Repuls_from_NODE = getParamComponent_s(PARAM_PARAMAVANCE_FORCE_REPULSFROMNODE).getValue_double();
		params.poidsForce_Repuls_from_PATH = getParamComponent_s(PARAM_PARAMAVANCE_FORCE_REPULSFROMLINE).getValue_double();
		params.poidsForce_AttractPosition_NODE = getParamComponent_s(PARAM_PARAMAVANCE_FORCE_ATTRACTPOSNODE).getValue_double();
		params.poidsForce_AttractPosition_PATH = getParamComponent_s(PARAM_PARAMAVANCE_FORCE_ATTRACTPOSLINE).getValue_double();
		params.poidsForce_Entrainement_by_NODE = getParamComponent_s(PARAM_PARAMAVANCE_FORCE_ENTRAINBYNODE).getValue_double();
		params.poidsForce_RespectForme_PATH = getParamComponent_s(PARAM_PARAMAVANCE_FORCE_RESPECTFORME).getValue_double();


		params.echelleInit = 1/getParamComponent_s(PARAM_PARAMAVANCE_ALGO_ECHELLEINIT).getValue_double();
		params.echelleInit = Math.max(params.echelleInit, params.echelleCible);
		params.facteurIncrementEchelle = getParamComponent_s(PARAM_PARAMAVANCE_ALGO_ACCROISSECHELLE).getValue_double();
		params.nbIterParEchelle = getParamComponent_s(PARAM_PARAMAVANCE_ALGO_NBITERPARECHELLE).getValue_int();
		
		params.nbIterFinal = getParamComponent_s(PARAM_PARAMAVANCE_ALGO_NBITERFINAL).getValue_int();
		params.poidsForce_RespectForme_PATH_final = getParamComponent_s(PARAM_PARAMAVANCE_ALGO_POIDFORCE_RESPECT_FORME_FINAL).getValue_double();


		params.pasTemps = getParamComponent_s(PARAM_PARAMAVANCE_ALGO_PAS_TEMP).getValue_double();
		params.facteurFrottement = getParamComponent_s(PARAM_PARAMAVANCE_ALGO_FACTEUR_FROTTEMENT).getValue_double();

		
		// En mode debug, possible demande de Zoom sur un node particulier
		if (Logger.isDebugLevel()) {
			if (!dlg_ls.tf_DEBUG_IDNODE.getText().trim().isEmpty() && !dlg_ls.tf_DEBUG_CHAMPID.getText().trim().isEmpty()) {
				String champ_id = dlg_ls.tf_DEBUG_CHAMPID.getText().trim();
				String id_node = dlg_ls.tf_DEBUG_IDNODE.getText().trim().toUpperCase();
				
				params.extraitData_use = true;
				params.extraitData_fieldName = dlg_ls.tf_DEBUG_CHAMPID.getText().trim();
				params.extraitData_fieldValue = dlg_ls.tf_DEBUG_IDNODE.getText().trim();
				if (Utils.isFloat_strictPos(dlg_ls.tf_DEBUG_LARGEURVIEW.getText()))
					params.extraitData_largeur = Double.parseDouble(dlg_ls.tf_DEBUG_LARGEURVIEW.getText());
				else
					params.extraitData_largeur = 10000;
			} else 
				params.extraitData_use = false;
		}
		
		return params;
	}

}

